home *** CD-ROM | disk | FTP | other *** search
- class someFrogs.Puzzles.SlidingGroup extends someFrogs.Lake.MaskedPiece
- {
- var xd;
- var groupProps;
- var yd;
- var ini_depth;
- var lb;
- var piecesArr;
- var onPress;
- var onRelease;
- var onReleaseOutside;
- var onEnterFrame;
- static var symbolName = "SlidingGroup";
- static var symbolOwner = someFrogs.Puzzles.SlidingGroup;
- var className = "SlidingGroup";
- var enabled = false;
- var active = true;
- var xp = 0;
- var yp = 0;
- function SlidingGroup()
- {
- super();
- this._x = this.xd = this.xp = this.groupProps.x;
- this._y = this.yd = this.yp = this.groupProps.y;
- this.ini_depth = this.getDepth();
- this.set_hint_style();
- this.setEnabled(this._parent.enabled);
- }
- function set_hint_style(Void)
- {
- if(this.lb != undefined)
- {
- this.lb.removeTextField();
- }
- if(this._parent._hintStyle != "none")
- {
- var _loc2_ = "";
- if(this._parent._hintStyle == "count")
- {
- _loc2_ = this.groupProps.Hcount + 1;
- }
- else if(this._parent._hintStyle == "matrix")
- {
- _loc2_ = this.groupProps.Jorj + 1 + " " + (this.groupProps.Iorj + 1);
- }
- this.createLabel("lb",1001,_loc2_);
- this.lb.styleName = this;
- var _loc4_ = this.lb._getTextFormat();
- var _loc3_ = _loc4_.getTextExtent(_loc2_);
- this.lb._x = this.piecesArr[0].x;
- this.lb._y = this.piecesArr[0].y;
- this.lb._width = _loc3_.width + 5;
- this.lb._height = _loc3_.height + 5;
- this.lb.text = _loc2_;
- }
- }
- function setEnabled(eFl)
- {
- this.enabled = eFl;
- var _loc2_ = new Color(this);
- if(eFl)
- {
- _loc2_.setTransform({ra:100,ga:100,ba:100});
- if(this.active)
- {
- this.onPress = this.IamPressed;
- this.onRelease = this.onReleaseOutside = this.IamReleased;
- }
- else
- {
- delete this.onPress;
- delete this.onRelease;
- delete this.onReleaseOutside;
- }
- }
- else
- {
- this.onPress = this.onRelease = this.onReleaseOutside = null;
- _loc2_.setTransform(this._parent.disabled_color);
- this._x = this.xd = this.xp = this.groupProps.x;
- this._y = this.yd = this.yp = this.groupProps.y;
- }
- }
- function IamPressed()
- {
- this._parent.childPressed(this);
- }
- function IamReleased()
- {
- this._parent.childReleased(this);
- }
- function put_me_to(eJ, eI)
- {
- var _loc3_ = this.groupProps.x + (eI - this.groupProps.I) * this.groupProps.w;
- var _loc2_ = this.groupProps.y + (eJ - this.groupProps.J) * this.groupProps.h;
- this.xd = _loc3_;
- this.yd = _loc2_;
- this.renderMe();
- this.groupProps.x = _loc3_;
- this.groupProps.y = _loc2_;
- this.groupProps.I = eI;
- this.groupProps.J = eJ;
- }
- function renderMe()
- {
- this.xp = this.xp * 0.25 + (this.xd - this._x) * 0.4;
- this.yp = this.yp * 0.25 + (this.yd - this._y) * 0.4;
- if(Math.abs(this.xp) < 0.25 && Math.abs(this.yp) < 0.25 && Math.abs(this._x - this.xd) < 0.25 && Math.abs(this._y - this.yd) < 0.25)
- {
- this._x = this.xd;
- this._y = this.yd;
- delete this.onEnterFrame;
- }
- else
- {
- this._x += this.xp;
- this._y += this.yp;
- if(this.onEnterFrame != this.renderMe)
- {
- this.onEnterFrame = this.renderMe;
- }
- }
- }
- function size(Void)
- {
- super.size();
- }
- function init(Void)
- {
- super.init();
- }
- }
-